home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / Obrn-A_1.6_lib.lha / oberon-a / source3.lha / source / 3rdParty / ARP.mod < prev    next >
Text File  |  1995-06-29  |  59KB  |  1,449 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: ARP.mod $
  4.   Description: Interface to arp.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 2.11 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:11:42 $
  10.  
  11.   Copyright © 1994-1995, Frank Copeland.
  12.   This file is part of the Oberon-A Library.
  13.   See Oberon-A.doc for conditions of use and distribution.
  14.  
  15. *************************************************************************)
  16.  
  17. <* STANDARD- *>
  18.  
  19. MODULE [2] ARP;
  20.  
  21. (*
  22.  ************************************************************************
  23.  *                                                                      *
  24.  * 5/3/89       ARPbase.h       by MKSoft from ARPbase.i by SDB         *
  25.  *                                                                      *
  26.  ************************************************************************
  27.  *                                                                      *
  28.  *      AmigaDOS Resource Project -- Library Include File               *
  29.  *                                   for Lattice C 5.x or Manx C 5.x    *
  30.  *                                                                      *
  31.  ************************************************************************
  32.  *                                                                      *
  33.  *      Copyright (c) 1987/1988/1989 by Scott Ballantyne                *
  34.  *                                                                      *
  35.  *      The arp.library, and related code and files may be freely used  *
  36.  *      by supporters of ARP.  Modules in the arp.library may not be    *
  37.  *      extracted for use in independent code, but you are welcome to   *
  38.  *      provide the arp.library with your work and call on it freely.   *
  39.  *                                                                      *
  40.  *      You are equally welcome to add new functions, improve the ones  *
  41.  *      within, or suggest additions.                                   *
  42.  *                                                                      *
  43.  *      BCPL programs are not welcome to call on the arp.library.       *
  44.  *      The welcome mat is out to all others.                           *
  45.  *                                                                      *
  46.  ************************************************************************
  47.  *                                                                      *
  48.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  49.  *            If your compiler has other defines for this, you may wish *
  50.  *            to remove the prototype for IoErr() from this file.       *
  51.  *                                                                      *
  52.  ************************************************************************
  53.  *)
  54.  
  55. (*
  56.  ************************************************************************
  57.  *      First we need to include the Amiga Standard Include files...    *
  58.  ************************************************************************
  59.  *)
  60.  
  61.  
  62. IMPORT
  63.   SYS := SYSTEM, Kernel,
  64.   e := Exec, d := Dos, g := Graphics, i := Intuition, s := Sets;
  65.  
  66. (* All pointers are declared first for convenience *)
  67.  
  68. TYPE
  69.  
  70.   ArpBasePtr *             = POINTER TO ArpBase;
  71.   EnvBasePtr *             = POINTER TO EnvBase;
  72.   FileRequesterPtr *       = POINTER TO FileRequester;
  73.   AnchorPathPtr *          = POINTER TO AnchorPath;
  74.   AChainPtr *              = POINTER TO AChain;
  75.   DirectoryEntryPtr *      = POINTER TO DirectoryEntry;
  76.   TrackedResourcePtr *     = POINTER TO TrackedResource;
  77.   DefaultTrackerPtr *      = POINTER TO DefaultTracker;
  78.   ResListPtr *             = POINTER TO ResList;
  79.   ZombieMsgPtr *           = POINTER TO ZombieMsg;
  80.   ProcessControlBlockPtr * = POINTER TO ProcessControlBlock;
  81.   NewShellPtr *            = POINTER TO NewShell;
  82.   ResidentProgramNodePtr * = POINTER TO ResidentProgramNode;
  83.   ResidentProgramTagPtr *  = POINTER TO ResidentProgramTag;
  84.   ProcessMemoryPtr *       = POINTER TO ProcessMemory;
  85.   DateTimePtr *            = POINTER TO DateTime;
  86.  
  87.  
  88. CONST
  89.  
  90. (*
  91.  ************************************************************************
  92.  *      Standard definitions for arp library information                *
  93.  ************************************************************************
  94.  *)
  95.  
  96.   arpName *    = "arp.library";   (* Name of library... *)
  97.   arpVersion * = 39;              (* Current version... *)
  98.  
  99. TYPE
  100.  
  101. (*
  102.  ************************************************************************
  103.  *      The current ARP library node...                                 *
  104.  ************************************************************************
  105.  *)
  106.  
  107.   ArpBase * = RECORD (e.LibraryBase)
  108.     libNode *      : e.Library;     (* Standard library node               *)
  109.     dosRootNode *  : d.RootNodePtr; (* Copy of dlRoot                      *)
  110.     abFlags *      : s.SET8;        (* See bitdefs below                   *)
  111.     escChar *      : CHAR;          (* Character to be used for escaping   *)
  112.     arpReserved1 * : LONGINT;       (* ArpLib's use only!!                 *)
  113.     envBase *      : e.LibraryPtr;  (* Dummy library for MANX compatibility*)
  114.     dosBase *      : d.DosLibraryPtr;(* Cached DosBase                      *)
  115.     gfxBase *      : g.GfxBasePtr;  (* Cached GfxBase                      *)
  116.     intuiBase *    : i.IntuitionBasePtr;(* Cached IntuitionBase                *)
  117.     resLists *     : e.MinList;     (* Resource trackers                   *)
  118.     residentPrgList * : ResidentProgramNodePtr; (* Resident Programs.        *)
  119.     resPrgProtection * : e.SignalSemaphore; (* protection for above       *)
  120.     segList *      : e.BPTR;        (* Pointer to loaded libcode (a BPTR). *)
  121.   END; (* ArpBase *)
  122.  
  123. TYPE
  124.  
  125. (*
  126.  ***********************************"*"**********************************
  127.  *      The following is here *ONLY* for information and for            *
  128.  *      compatibility with MANX.  DO NOT use in new code!               *
  129.  ************************************************************************
  130.  *)
  131.  
  132.   EnvBase * = RECORD
  133.     libNode *  : e.Library;  (* Standard library node for linkage    *)
  134.     envSpace * : e.ADDRESS;  (* Access only when Forbidden!          *)
  135.     envSize *  : e.ULONG;    (* Total allocated mem for EnvSpace     *)
  136.     arpBase *  : ArpBasePtr; (* Added in V32 for Resource Tracking   *)
  137.   END; (* EnvBase *)
  138.  
  139.  
  140. CONST
  141.  
  142. (*
  143.  ************************************************************************
  144.  *      These are used in release 33.4 but not by the library code.     *
  145.  *      Instead, individual programs check for these flags.             *
  146.  ************************************************************************
  147.  *)
  148.  
  149.   arpWildWorld * = 0;              (* Mixed BCPL/Normal wildcards. *)
  150.   arpWildBCPL  * = 1;              (* Pure BCPL wildcards.         *)
  151.  
  152.  
  153. CONST
  154.  
  155. (*
  156.  ************************************************************************
  157.  * The alert object is what you use if you really must return an alert  *
  158.  * to the user. You would normally OR this with another alert number    *
  159.  * from the alerts.h file. Generally, should be NON deadend alerts.     *
  160.  *                                                                      *
  161.  * For example, if you can't open ArpLibrary:                           *
  162.  *      Alert( (AgOpenLib|AoArpLib), 0L);                               *
  163.  ************************************************************************
  164.  *)
  165.  
  166.   aoArpLib       * = 00008036H;             (* Alert object *)
  167.  
  168. CONST
  169.  
  170. (*
  171.  ************************************************************************
  172.  *      Alerts that arp.library may return...                           *
  173.  ************************************************************************
  174.  *)
  175.  
  176.   anArpLib       * = 03600000H;   (* Alert number                         *)
  177.   anArpNoMem     * = 03610000H;   (* No more memory                       *)
  178.   anArpInputMem  * = 03610002H;   (* No memory for input buffer           *)
  179.   anArpNoMakeEnv * = 83610003H;   (* No memory to make EnvLib             *)
  180.  
  181.   anArpNoDOS     * = 83630001H;   (* Can't open dos.library               *)
  182.   anArpNoGfx     * = 83630002H;   (* Can't open graphics.library          *)
  183.   anArpNoIntuit  * = 83630003H;   (* Can't open intuition                 *)
  184.   anBadPackBlues * = 83640000H;   (* Bad packet returned to SendPacket()  *)
  185.   anZombie       * = 83600003H;   (* Zombie roaming around system         *)
  186.  
  187.   anArpScattered * = 83600002H;   (* Scatter loading not allowed for arp  *)
  188.  
  189.  
  190. CONST
  191.  
  192. (*
  193.  ************************************************************************
  194.  *      Return codes you can get from calling ARP Assign()...           *
  195.  ************************************************************************
  196.  *)
  197.  
  198.   assignOK       * = 0; (* Everything is cool and groovey                *)
  199.   assignNODEV    * = 1; (* "Physical" is not valid for assignment        *)
  200.   assignFATAL    * = 2; (* Something really icky happened                *)
  201.   assignCANCEL   * = 3; (* Tried to cancel something but it won't cancel *)
  202.  
  203. CONST
  204.  
  205. (*
  206.  ************************************************************************
  207.  *      Size of buffer you need if you are going to call ReadLine()     *
  208.  ************************************************************************
  209.  *)
  210.  
  211.   maxInputBuf     * = 256;
  212.  
  213. TYPE
  214.  
  215. (*
  216.  ************************************************************************
  217.  *      The ARP file requester data structure...                        *
  218.  ************************************************************************
  219.  *)
  220.  
  221.  
  222.   FileRequester * = RECORD
  223.     hail *      : e.ADDRESS;   (* Hailing text                 *)
  224.     file *      : e.ADDRESS;   (* Filename array (FCHARS + 1)  *)
  225.     dir *       : e.ADDRESS;   (* Directory array (DSIZE + 1)  *)
  226.     window *    : i.WindowPtr; (* Window requesting or NULL    *)
  227.     funcFlags * : s.SET8;      (* Set bitdef's below           *)
  228.     flags2 *    : s.SET8;      (* New flags...                 *)
  229.     function *  : PROCEDURE(); (* Your function, see bitdef's  *)
  230.     leftEdge *  : INTEGER;     (* To be used later...          *)
  231.     topEdge *   : INTEGER;
  232.   END; (* FileRequester *)
  233.  
  234.  
  235. CONST
  236.  
  237. (*
  238.  ************************************************************************
  239.  * The following are the defines for frFuncFlags.  These bits tell      *
  240.  * FileRequest() what your frUserFunc is expecting, and what            *
  241.  * FileRequest() should call it for.                                    *
  242.  *                                                                      *
  243.  * You are called like so:                                              *
  244.  * frFunction(Mask, Object)                                             *
  245.  * e.ULONG        Mask;                                                 *
  246.  * e.APTR         *Object;                                              *
  247.  *                                                                      *
  248.  * The Mask is a copy of the flag value that caused FileRequest() to    *
  249.  * call your function. You can use this to determine what action you    *
  250.  * need to perform, and exactly what Object is, so you know what to do  *
  251.  * and what to return.                                                  *
  252.  ************************************************************************
  253.  *)
  254.  
  255.   doWildFunc  * = 7; (* Call me with a FIB and a name, ZERO return accepts.       *)
  256.   doMsgFunc   * = 6; (* You get all IDCMP messages not for FileRequest()          *)
  257.   doColor     * = 5; (* Set this bit for that new and different look              *)
  258.   newIDCMP    * = 4; (* Force a new IDCMP (only if frWindow != NULL)             *)
  259.   newWindFunc * = 3; (* You get to modify the newwindow structure.                *)
  260.   addGadFunc  * = 2; (* You get to add gadgets.                                   *)
  261.   gEventFunc  * = 1; (* Function to call if one of your gadgets is selected.      *)
  262.   listFunc    * = 0; (* Not implemented yet.                                      *)
  263.  
  264.  
  265. CONST
  266.  
  267. (*
  268.  ************************************************************************
  269.  * The FR2 bits are for frFlags2 in the file requester structure     *
  270.  ************************************************************************
  271.  *)
  272.  
  273.   longPath   * = 0; (* Specify the frDir buffer is 256 bytes long *)
  274.  
  275.  
  276. CONST
  277.  
  278. (*
  279.  ************************************************************************
  280.  *      The sizes of the different buffers...                           *
  281.  ************************************************************************
  282.  *)
  283.  
  284.   fChars * = 32;     (* Filename size                              *)
  285.   dSize *  = 33;     (* Directory name size if not FR2LongPath     *)
  286.  
  287.   longDSize * = 254;    (* If FR2LongPath is set, use longDSIZE    *)
  288.   longFSize * = 126;    (* For compatibility with ARPbase.i        *)
  289.  
  290.   firstGadget * = 7680H; (* User gadgetID's must be less than this value *)
  291.  
  292.  
  293. TYPE
  294.  
  295. (*
  296.  ************************************************************************
  297.  * Structure expected by FindFirst()/FindNext()                         *
  298.  *                                                                      *
  299.  * You need to allocate this structure and initialize it as follows:    *
  300.  *                                                                      *
  301.  * Set apBreakBits to the signal bits (CDEF) that you want to take a    *
  302.  * break on, or NULL, if you don't want to convenience the user.        *
  303.  *                                                                      *
  304.  * if you want to have the FULL PATH NAME of the files you found,       *
  305.  * allocate a buffer at the END of this structure, and put the size of  *
  306.  * it into apStrLen.  If you don't want the full path name, make sure   *
  307.  * you set apStrLen to zero.  In this case, the name of the file, and   *
  308.  * stats are available in the apInfo, as per usual.                     *
  309.  *                                                                      *
  310.  * Then call FindFirst() and then afterwards, FindNext() with this      *
  311.  * structure.  You should check the return value each time (see below)  *
  312.  * and take the appropriate action, ultimately calling                  *
  313.  * FreeAnchorChain() when there are no more files and you are done.     *
  314.  * You can tell when you are done by checking for the normal AmigaDOS   *
  315.  * return code errorNoMoreENTRIES.                                      *
  316.  *                                                                      *
  317.  * You will also have to check the DirEntryType variable in the apInfo  *
  318.  * structure to determine what exactly you have received.               *
  319.  ************************************************************************
  320.  *)
  321.  
  322.   AnchorPath * = RECORD
  323.     base *       : AChainPtr; (* Pointer to first anchor                *)
  324.     last *       : AChainPtr; (* Pointer to last anchor                 *)
  325.     breakBits *  : s.SET32;   (* Bits to break on                       *)
  326.     foundBreak * : s.SET32;   (* Bits we broke on. Also returns ERROR_BREAK *)
  327.     flags *      : s.SET8;    (* New use for the extra word...          *)
  328.     reserved *   : SYS.BYTE;  (* To fill it out...                      *)
  329.     strLen *     : INTEGER;   (* This is what used to be apLength       *)
  330.     info *       : d.FileInfoBlock;
  331.   (*buf *        : ARRAY OF SYS.BYTE; (* Allocate a buffer here, if desired *)*)
  332.   END; (* AnchorPath *)
  333.  
  334. CONST
  335.  
  336. (*
  337.  ************************************************************************
  338.  *      Bit definitions for the new apFlags...                         *
  339.  ************************************************************************
  340.  *)
  341.  
  342.   doWild      * = 0;    (* User option ALL                              *)
  343.   itsWild     * = 1;    (* Set by FindFirst, used by FindNext           *)
  344.   doDir       * = 2;    (* Bit is SET if a DIR node should be entered   *)
  345.                         (* Application can RESET this bit po AVOID      *)
  346.                         (* entering a dir.                              *)
  347.   didDir      * = 3;    (* Bit is set for an "expired" dir node         *)
  348.   noMemErr    * = 4;    (* Set if there was not enough memory           *)
  349.   doDot       * = 5;    (* If set, '.' (DOT) will convert to CurrentDir *)
  350.  
  351.  
  352. TYPE
  353.  
  354. (*
  355.  ************************************************************************
  356.  * Structure used by the pattern matching functions, no need to obtain, *
  357.  * diddle or allocate this yourself.                                    *
  358.  *                                                                      *
  359.  * Note:  If you did, you will now break as it has changed...           *
  360.  ************************************************************************
  361.  *)
  362.  
  363.   AChain * = RECORD
  364.     child *  : AChainPtr;
  365.     parent * : AChainPtr;
  366.     lock *   : d.FileLockPtr;
  367.     info *   : d.FileInfoBlockPtr;
  368.     flags *  : s.SET8;
  369.     string * : ARRAY 1 OF CHAR;   (* Just as is .i file   *)
  370.   END; (* AChain *)               (* ???  Don't use this! *)
  371.  
  372. CONST
  373.  
  374.   patternBit  * = 0;
  375.   examinedBit * = 1;
  376.   completed   * = 2;
  377.   allBit      * = 3;
  378.  
  379.  
  380. CONST
  381.  
  382. (*
  383.  ************************************************************************
  384.  * Constants used by wildcard routines                                  *
  385.  *                                                                      *
  386.  * These are the pre-parsed tokens referred to by pattern match.  It    *
  387.  * is not necessary for you to do anything about these, FindFirst()     *
  388.  * FindNext() handle all these for you.                                 *
  389.  ************************************************************************
  390.  *)
  391.  
  392.   any           * = 80X;   (* Token for '*' | '#?' *)
  393.   single        * = 81X;   (* Token for '?'        *)
  394.  
  395. CONST
  396.  
  397. (*
  398.  ************************************************************************
  399.  * No need to muck with these as they may change...                     *
  400.  ************************************************************************
  401.  *)
  402.  
  403.   orStart       * = 82X;   (* Token for '('        *)
  404.   orNext        * = 83X;   (* Token for '|'        *)
  405.   OrEnd         * = 84X;   (* Token for ')'        *)
  406.   not           * = 85X;   (* Token for '~'        *)
  407.   notClass      * = 87X;   (* Token for '^'        *)
  408.   class         * = 88X;   (* Token for '[]'       *)
  409.   repBeg        * = 89X;   (* Token for '['        *)
  410.   repEnd        * = 8AX;   (* Token for ']'        *)
  411.  
  412.  
  413. TYPE
  414.  
  415. (*
  416.  ************************************************************************
  417.  * Structure used by AddDANode(), AddDADevs(), FreeDAList().            *
  418.  *                                                                      *
  419.  * This structure is used to create lists of names, which normally      *
  420.  * are devices, assigns, volumes, files, or directories.                *
  421.  ************************************************************************
  422.  *)
  423.  
  424.   DirectoryEntry * = RECORD
  425.     next *  : DirectoryEntryPtr; (* Next in list                      *)
  426.     type *  : SHORTINT;          (* dlxmumble                         *)
  427.     flags * : s.SET8;            (* For future expansion, DO NOT USE! *)
  428.     name *  : ARRAY 256 OF CHAR; (* The name of the thing found       *)
  429.   END; (* DirectoryEntry *)
  430.  
  431. CONST
  432.  
  433. (*
  434.  ************************************************************************
  435.  * Defines you use to get a list of the devices you want to look at.    *
  436.  * For example, to get a list of all directories and volumes, do:       *
  437.  *                                                                      *
  438.  *      AddDADevs( mydalist, (DlfDIRS | dlfVOLUMES) )                   *
  439.  *                                                                      *
  440.  * After this, you can examine the detype field of the elements added   *
  441.  * to your list (if any) to discover specifics about the objects added. *
  442.  *                                                                      *
  443.  * Note that if you want only devices which are also disks, you must    *
  444.  * (DlfDEVICES | dlfDISKONLY).                                          *
  445.  ************************************************************************
  446.  *)
  447.  
  448.   devices     * = 0;      (* Return devices                               *)
  449.   diskOnly    * = 1;      (* Modifier for above: Return disk devices only *)
  450.   volumes     * = 2;      (* Return volumes only                          *)
  451.   dirs        * = 3;      (* Return assigned devices only                 *)
  452.  
  453.  
  454. CONST
  455.  
  456. (*
  457.  ************************************************************************
  458.  * Legal deType values, check for these after a call to AddDADevs(),    *
  459.  * or use on your own as the ID values in AddDANode().                  *
  460.  ************************************************************************
  461.  *)
  462.  
  463.   file        * = 0;      (* AddDADevs() can't determine this     *)
  464.   dir         * = 8;      (* AddDADevs() can't determine this     *)
  465.   device      * = 16H;    (* It's a resident device               *)
  466.   volume      * = 24H;    (* Device is a volume                   *)
  467.   unmounted   * = 32H;    (* Device is not resident               *)
  468.   assign      * = 40H;    (* Device is a logical assignment       *)
  469.  
  470. (*
  471.  ************************************************************************
  472.  *      Resource Tracking stuff...                                      *
  473.  ************************************************************************
  474.  *                                                                      *
  475.  * There are a few things in arp.library that are only directly         *
  476.  * acessable from assembler.  The glue routines provided by us for      *
  477.  * all 'C' compilers use the following conventions to make these        *
  478.  * available to C programs.  The glue for other language's should use   *
  479.  * as similar a mechanism as possible, so that no matter what language  *
  480.  * or compiler we speak, when talk about arp, we will know what the     *
  481.  * other guy is saying.                                                 *
  482.  *                                                                      *
  483.  * Here are the cases:                                                  *
  484.  *                                                                      *
  485.  * Tracker calls...                                                     *
  486.  *              These calls return the Tracker pointer as a secondary   *
  487.  *              result in the register A1.  For C, there is no clean    *
  488.  *              way to return more than one result so the tracker       *
  489.  *              pointer is returned in IoErr().  For ease of use,       *
  490.  *              there is a define that typecasts IoErr() to the correct *
  491.  *              pointer type.  This is called LastTracker and should    *
  492.  *              be source compatible with the earlier method of storing *
  493.  *              the secondary result.                                   *
  494.  *                                                                      *
  495.  * GetTracker() -                                                       *
  496.  *              Syntax is a bit different for C than the assembly call  *
  497.  *              The C syntax is GetTracker(ID).  The binding routines   *
  498.  *              will store the ID into the tracker on return.  Also,    *
  499.  *              in an effort to remain consistant, the tracker will     *
  500.  *              also be stored in LastTracker.                          *
  501.  *                                                                      *
  502.  * In cases where you have allocated a tracker before you have obtained *
  503.  * a resource (usually the most efficient method), and the resource has *
  504.  * not been obtained, you will need to clear the tracker id.  The macro *
  505.  * clearID() has been provided for that purpose.  It expects a pointer *
  506.  * to a DefaultTracker sort of struct.                                  *
  507.  ************************************************************************
  508.  
  509. #define CLEAR_ID(t)     ((SHORT * ) t)[-1]* =NULL
  510.  
  511.  ************************************************************************
  512.  * You MUST prototype IoErr() to prevent the possible error in defining *
  513.  * IoErr() and thus causing LastTracker to give you trash...            *
  514.  *                                                                      *
  515.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  516.  *            If your compiler has other defines for this, you may wish *
  517.  *            to remove the prototype for IoErr().                      *
  518.  ************************************************************************
  519.  
  520. #define LastTracker     ((struct DefaultTracker * )IoErr())
  521. *)
  522.  
  523. TYPE
  524.  
  525. (*
  526.  ************************************************************************
  527.  * The rlFirstItem list (ResList) is a list of TrackedResource (below)  *
  528.  * It is very important that nothing in this list depend on the task    *
  529.  * existing at resource freeing time (i.e., RemTask(0L) type stuff,     *
  530.  * DeletePort() and the rest).                                          *
  531.  *                                                                      *
  532.  * The tracking functions return a struct Tracker *Tracker to you, this *
  533.  * is a pointer to whatever follows the trID variable.                  *
  534.  * The default case is reflected below, and you get it if you call      *
  535.  * GetTracker() ( see DefaultTracker below).                            *
  536.  *                                                                      *
  537.  * NOTE: The two user variables mentioned in an earlier version don't   *
  538.  * exist, and never did. Sorry about that (SDB).                        *
  539.  *                                                                      *
  540.  * However, you can still use ArpAlloc() to allocate your own tracking  *
  541.  * nodes and they can be any size or shape you like, as long as the     *
  542.  * base structure is preserved. They will be freed automagically just   *
  543.  * like the default trackers.                                           *
  544.  ************************************************************************
  545.  *)
  546.  
  547.   TrackedResource * = RECORD
  548.     node *   : e.MinNode;      (* Double linked pointer                *)
  549.     flags *  : s.SET8;         (* Don't touch                          *)
  550.     lock *   : SYS.BYTE;       (* Don't touch, for Get/FreeAccess()    *)
  551.     id *     : INTEGER;        (* Item's ID                            *)
  552. (*
  553.  ************************************************************************
  554.  * The struct DefaultTracker *Tracker portion of the structure.         *
  555.  * The stuff below this point can conceivably vary, depending           *
  556.  * on user needs, etc.  This reflects the default.                      *
  557.  ************************************************************************
  558.  *)
  559.     object * : e.ADDRESS;
  560.     extra *  : e.ADDRESS;
  561.   END; (* TrackedResource *)
  562.  
  563.  
  564. TYPE
  565.  
  566. (*
  567.  ************************************************************************
  568.  * You get a pointer to a struct of the following type when you call    *
  569.  * GetTracker().  You can change this, and use ArpAlloc() instead of    *
  570.  * GetTracker() to do tracking. Of course, you have to take a wee bit   *
  571.  * more responsibility if you do, as well as if you use trakGeneric     *
  572.  * stuff.                                                               *
  573.  *                                                                      *
  574.  * trakGeneric folks need to set up a task function to be called when   *
  575.  * an item is freed.  Some care is required to set this up properly.    *
  576.  *                                                                      *
  577.  * Some special cases are indicated by the unions below, for            *
  578.  * trakWindow, if you have more than one window opened, and don't       *
  579.  * want the IDCMP closed particularly, you need to set a ptr to the     *
  580.  * other window in dtWindow2.  See CloseWindowSafely() for more info.   *
  581.  * If only one window, set this to NULL.                                *
  582.  ************************************************************************
  583.  *)
  584.  
  585.   DefaultTracker * = RECORD
  586.     object * : e.ADDRESS;
  587.     extra *  : e.ADDRESS;
  588.   END; (* DefaultTracker *)
  589.  
  590. CONST
  591.  
  592. (*
  593.  ************************************************************************
  594.  *      Items the tracker knows what to do about                        *
  595.  ************************************************************************
  596.  *)
  597.  
  598.   aAMem      * = 0;      (* Default (ArpAlloc) element           *)
  599.   lock       * = 1;      (* File lock                            *)
  600.   trFile     * = 2;      (* Opened file                          *)
  601.   window     * = 3;      (* Window -- see docs                   *)
  602.   screen     * = 4;      (* Screen                               *)
  603.   library    * = 5;      (* Opened library                       *)
  604.   dAMem      * = 6;      (* Pointer to DosAllocMem block         *)
  605.   memNode    * = 7;      (* AllocEntry() node                    *)
  606.   segList    * = 8;      (* Program segment                      *)
  607.   resList    * = 9;      (* ARP (nested) ResList                 *)
  608.   mem        * = 10;     (* Memory ptr/length                    *)
  609.   generic    * = 11;     (* Generic Element, your choice         *)
  610.   dAList     * = 12;     (* DAlist ( aka file request )          *)
  611.   anchor     * = 13;     (* Anchor chain (pattern matching)      *)
  612.   fReq       * = 14;     (* FileRequest struct                   *)
  613.   font       * = 15;     (* GfxBase CloseFont()                  *)
  614.   max        * = 15;     (* Poof, anything higher is tossed      *)
  615.  
  616.   unlink      * = 7;      (* Free node bit                        *)
  617.   reloc       * = 6;      (* This may be relocated (not used yet) *)
  618.   moved       * = 5;      (* Item moved                           *)
  619.  
  620.  
  621. TYPE
  622.  
  623. (*
  624.  ************************************************************************
  625.  * Note: ResList MUST be a DosAllocMem'ed list!, this is done for       *
  626.  * you when you call CreateTaskResList(), typically, you won't need     *
  627.  * to access/allocate this structure.                                   *
  628.  ************************************************************************
  629.  *)
  630.  
  631.   ResList * = RECORD
  632.     node *      : e.MinNode;  (* Used by arplib to link reslists      *)
  633.     taskID *    : e.TaskPtr;  (* Owner of this list                   *)
  634.     firstItem * : e.MinList;  (* List of Tracked Resources            *)
  635.     link *      : ResListPtr; (* SyncRun's use - hide list here       *)
  636.   END; (* ResList *)
  637.  
  638. CONST
  639.  
  640. (*
  641.  ************************************************************************
  642.  *      Returns from CompareLock()                                      *
  643.  ************************************************************************
  644.  *)
  645.  
  646.   equal       * = 0;   (* The two locks refer to the same object       *)
  647.   clVolume    * = 1;   (* Locks are on the same volume                 *)
  648.   difVol1     * = 2;   (* Locks are on different volumes               *)
  649.   difVol2     * = 3;   (* Locks are on different volumes               *)
  650.  
  651. TYPE
  652.  
  653. (*
  654.  ************************************************************************
  655.  *      ASyncRun() stuff...                                             *
  656.  ************************************************************************
  657.  * Message sent back on your request by an exiting process.             *
  658.  * You request this by putting the address of your message in           *
  659.  * pcbLastGasp, and initializing the ReplyPort variable of your         *
  660.  * ZombieMsg to the port you wish the message posted to.                *
  661.  ************************************************************************
  662.  *)
  663.  
  664.   ZombieMsg * = RECORD
  665.     execMessage * : e.Message;
  666.     taskNum *     : e.ULONG; (* Task ID                      *)
  667.     returnCode *  : LONGINT; (* Process's return code        *)
  668.     result2 *     : e.ULONG; (* System return code           *)
  669.     exitTime *    : d.Date;  (* Date stamp at time of exit   *)
  670.     userInfo *    : e.ULONG; (* For whatever you wish        *)
  671.   END; (* ZombieMsg *)
  672.  
  673. TYPE
  674.  
  675. (*
  676.  ************************************************************************
  677.  * Structure required by ASyncRun() -- see docs for more info.          *
  678.  ************************************************************************
  679.  *)
  680.  
  681.   ProcessControlBlock * = RECORD
  682.     stackSize * : e.ULONG;      (* Stacksize for new process                    *)
  683.     pri *       : SHORTINT;     (* Priority of new task                         *)
  684.     control *   : s.SET8;       (* Control bits, see defines below              *)
  685.     trapCode *  : e.ADDRESS;    (* Optional Trap Code                           *)
  686.     input *     : e.BPTR;
  687.     output *    : e.BPTR;       (* Optional stdin, stdout                       *)
  688.     console *   : LONGINT;
  689.     (* console is a union of:
  690.       splatFile * : e.BPTR;     (* File to use for Open("*")                    *)
  691.       conName *   : e.LSTRPTR;  (* CON: filename                                *)
  692.     *)
  693.     loadedCode * : e.ADDRESS;   (* If not null, will not load/unload code       *)
  694.     lastGasp *  : ZombieMsgPtr; (* ReplyMsg() to be filled in by exit           *)
  695.     wbProcess * : e.MsgPort;    (* Valid only when prNOCLI                    *)
  696.   END; (* ProcessControlBlock *)
  697.  
  698. CONST
  699.  
  700. (*
  701.  ************************************************************************
  702.  * Formerly needed to pass NULLCMD to a child.  No longer needed.       *
  703.  * It is being kept here for compatibility only...                      *
  704.  ************************************************************************
  705.  *)
  706.  
  707.   NoCmd   * = "\n";
  708.  
  709. CONST
  710.  
  711. (*
  712.  ************************************************************************
  713.  * The following control bits determine what ASyncRun() does on         *
  714.  * Abnormal Exits and on background process termination.                *
  715.  ************************************************************************
  716.  *)
  717.  
  718.   saveIO      * = 0;    (* Don't free/check file handles on exit        *)
  719.   closeSplat  * = 1;    (* Close Splat file, must request explicitly    *)
  720.   noCLI       * = 2;    (* Don't create a CLI process                   *)
  721. (*interactive * = 3;       This is now obsolete...                      *)
  722.   code        * = 4;    (* Dangerous yet enticing                       *)
  723.   stdio       * = 5;    (* Do the stdio thing, splat * = CON:Filename   *)
  724.  
  725.  
  726. CONST
  727.  
  728. (*
  729.  ************************************************************************
  730.  *      Error returns from SyncRun() and ASyncRun()                     *
  731.  ************************************************************************
  732.  *)
  733.  
  734.   noFile   * = -1;     (* Could not LoadSeg() the file                 *)
  735.   noMem    * = -2;     (* No memory for something                      *)
  736. (*noCLI      = -3;       This is now obsolete                          *)
  737.   noSlot   * = -4;     (* No room in TaskArray                         *)
  738.   noInput  * = -5;     (* Could not open input file                    *)
  739.   noOutput * = -6;     (* Could not get output file                    *)
  740. (*noLock     = -7;        This is now obsolete                         *)
  741. (*argErr     = -8;        This is now obsolete                         *)
  742. (*noBCPL     = -9;        This is now obsolete                         *)
  743. (*badLib     = -10;       This is now obsolete                         *)
  744.   noStdio  * = -11;    (* Couldn't get stdio handles                   *)
  745.  
  746. CONST
  747.  
  748. (*
  749.  ************************************************************************
  750.  *      Added V35 of arp.library                                        *
  751.  ************************************************************************
  752.  *)
  753.  
  754.   wantSMessage * = -12; (* Child wants you to report IoErr() to user    *)
  755.                           (* for SyncRun() only...                        *)
  756.   noShellProc  * = -13; (* Can't create a shell/cli process             *)
  757.   noExec       * = -14; (* 'E' bit is clear                             *)
  758.   script       * = -15; (* S and E are set, IoErr() contains directory  *)
  759.  
  760. TYPE
  761.  
  762. (*
  763.  ************************************************************************
  764.  * Version 35 ASyncRun() allows you to create an independent            *
  765.  * interactive or background Shell/CLi. You need this variant of the    *
  766.  * pcb structure to do it, and you also have new values for nshControl, *
  767.  * see below.                                                           *
  768.  *                                                                      *
  769.  * Syntax for Interactive shell is:                                     *
  770.  *                                                                      *
  771.  * rc=ASyncRun("Optional Window Name","Optional From File",&NewShell);  *
  772.  *                                                                      *
  773.  * Syntax for a background shell is:                                    *
  774.  *                                                                      *
  775.  * rc=ASyncRun("Command line",0L,&NewShell);                            *
  776.  *                                                                      *
  777.  * Same syntax for an Execute style call, but you have to be on drugs   *
  778.  * if you want to do that.                                              *
  779.  ************************************************************************
  780.  *)
  781.  
  782.   NewShell * = RECORD
  783.     stackSize * : e.ULONG;  (* stacksize shell will use for children        *)
  784.     pri *       : SHORTINT; (* ignored by interactive shells                *)
  785.     control *   : s.SET8;   (* bits/values: see above                       *)
  786.     logMsg *    : e.ADDRESS;(* Optional login message, if null, use default *)
  787.     input *     : e.BPTR;   (* ignored by interactive shells, but           *)
  788.     output *    : e.BPTR;   (* used by background and execute options.      *)
  789.     reserved *  : ARRAY 5 OF LONGINT;
  790.   END; (* NewShell *)
  791.  
  792. CONST
  793.  
  794. (*
  795.  ************************************************************************
  796.  * Bit Values for nshControl, you should use them as shown below, or    *
  797.  * just use the actual values indicated.                                *
  798.  ************************************************************************
  799.  *)
  800.  
  801.   cli         * = 0;      (* Do a CLI, not a shell        *)
  802.   backGround  * = 1;      (* Background shell             *)
  803.   execute     * = 2;      (* Do as EXECUTe...             *)
  804.   interactive * = 3;      (* Run an interactive shell     *)
  805.   fb          * = 7;      (* Alt function bit...          *)
  806.  
  807.  
  808. CONST
  809.  
  810. (*
  811.  ************************************************************************
  812.  *      Common values for shControl which allow you to do usefull      *
  813.  *      and somewhat "standard" things...                               *
  814.  ************************************************************************
  815.  *)
  816.  
  817.   interactiveShell * = { fb, interactive };         (* Gimme a newshell!            *)
  818.   interactiveCLI   * = { fb, interactive, cli };    (* Gimme that ol newcli!        *)
  819.   backgroundShell  * = { fb, backGround };          (* gimme a background shell     *)
  820.   executeMe        * = { fb, backGround, execute }; (* aptly named, doncha think?   *)
  821.  
  822. CONST
  823.  
  824. (*
  825.  ************************************************************************
  826.  *      Additional IoErr() returns added by ARP...                      *
  827.  ************************************************************************
  828.  *)
  829.  
  830.   errorBufferOverflow   * = 303;    (* User or internal buffer overflow     *)
  831.   errorBreak            * = 304;    (* A break character was received       *)
  832.   errorNotExecutable    * = 305;    (* A file has E bit cleared             *)
  833.   errorNotCLI           * = 400;    (* Program/function neeeds to be cli    *)
  834.  
  835. TYPE
  836.  
  837. (*
  838.  ************************************************************************
  839.  *      Resident Program Support                                        *
  840.  ************************************************************************
  841.  * This is the kind of node allocated for you when you AddResidentPrg() *
  842.  * a code segment.  They are stored as a single linked list with the    *
  843.  * root in ArpBase.  If you absolutely *must* wander through this list  *
  844.  * instead of using the supplied functions, then you must first obtain  *
  845.  * the semaphore which protects this list, and then release it          *
  846.  * afterwards.  Do not use Forbid() and Permit() to gain exclusive      *
  847.  * access!  Note that the supplied functions handle this locking        *
  848.  * protocol for you.                                                    *
  849.  ************************************************************************
  850.  *)
  851.  
  852.   ResidentProgramNode * = RECORD
  853.     next *      : ResidentProgramNodePtr; (* next or NULL        *)
  854.     usage *     : LONGINT;       (* Number of current users      *)
  855.     accessCnt * : e.UWORD;       (* Total times used...          *)
  856.     checkSum *  : e.ULONG;       (* Checksum of code             *)
  857.     segment *   : e.BPTR;        (* Actual segment               *)
  858.     flags *     : s.SET16;       (* See definitions below...     *)
  859.   (*name *      : ARRAY OF CHAR; (* Allocated as needed          *)*)
  860.   END; (* ResidentProgramNode *)
  861.  
  862. CONST
  863.  
  864. (*
  865.  ************************************************************************
  866.  *      Bit definitions for rpnFlags....                                *
  867.  ************************************************************************
  868.  *)
  869.  
  870.   noCheck * = 0;      (* Set in rpnFlags for no checksumming...      *)
  871.   cache *   = 1;      (* Private usage in v1.3...                    *)
  872.  
  873.  
  874. TYPE
  875.  
  876. (*
  877.  ************************************************************************
  878.  * If your program starts with this structure, ASyncRun() and SyncRun() *
  879.  * will override a users stack request with the value in rptStackSize.  *
  880.  * Furthermore, if you are actually attached to the resident list, a    *
  881.  * memory block of size rptDataSize will be allocated for you, and      *
  882.  * a pointer to this data passed to you in register A4.  You may use    *
  883.  * this block to clone the data segment of programs, thus resulting in  *
  884.  * one copy of text, but multiple copies of data/bss for each process   *
  885.  * invocation.  If you are resident, your program will start at         *
  886.  * rptInstruction, otherwise, it will be launched from the initial      *
  887.  * branch.                                                              *
  888.  ************************************************************************
  889.  *)
  890.  
  891.   ResidentProgramTag * = RECORD
  892.     nextSeg *   : e.BPTR;    (* Provided by DOS at LoadSeg time      *)
  893. (*
  894.  ************************************************************************
  895.  * The initial branch destination and rptInstruction do not have to be *
  896.  * the same.  This allows different actions to be taken if you are      *
  897.  * diskloaded or resident.  DataSize memory will be allocated only if   *
  898.  * you are resident, but StackSize will override all user stack         *
  899.  * requests.                                                            *
  900.  ************************************************************************
  901.  *)
  902.     bra *       : e.UWORD; (* Short branch to executable           *)
  903.     magic *     : e.UWORD; (* Resident majik value                 *)
  904.     stackSize * : e.ULONG; (* min stack for this process           *)
  905.     dataSize *  : e.ULONG; (* Data size to allocate if resident    *)
  906.     (*      instruction;        Start here if resident          *)
  907.   END; (* ResidentProgramTag *)
  908.  
  909. TYPE
  910.  
  911. (*
  912.  ************************************************************************
  913.  * The form of the ARP allocated node in your tasks memlist when        *
  914.  * launched as a resident program. Note that the data portion of the    *
  915.  * node will only exist if you have specified a nonzero value for       *
  916.  * rptDataSize. Note also that this structure is READ ONLY, modify     *
  917.  * values in this at your own risk.  The stack stuff is for tracking,   *
  918.  * if you need actual addresses or stack size, check the normal places  *
  919.  * for it in your process/task struct.                                  *
  920.  ************************************************************************
  921.  *)
  922.  
  923.   ProcessMemory * = RECORD
  924.     node *      : e.Node;
  925.     num *       : e.UWORD; (* This is 1 if no data, two if data    *)
  926.     stack *     : e.APTR;
  927.     stackSize * : e.ULONG;
  928.     data *      : e.APTR;  (* Only here if pmNum == 2              *)
  929.     dataSize *  : e.ULONG;
  930.   END; (* ProcessMemory *)
  931.  
  932. CONST
  933.  
  934. (*
  935.  ************************************************************************
  936.  * To find the above on your memlist, search for the following name.    *
  937.  * We guarantee this will be the only arp.library allocated node on     *
  938.  * your memlist with this name.                                         *
  939.  * i.e. FindName(task->tcbMemEntry, pmemNAME);                        *
  940.  ************************************************************************
  941.  *)
  942.  
  943.   pMemName       * = "ARP_MEM";
  944.  
  945.   residentMagic  * = 4AFCH;          (* same as rtcMATCHWORD (trapf) *)
  946.  
  947. TYPE
  948.  
  949. (*
  950.  ************************************************************************
  951.  *      Date String/Data structures                                     *
  952.  ************************************************************************
  953.  *)
  954.  
  955.   DateTime * = RECORD
  956.     stamp *   : d.Date;     (* DOS Datestamp                        *)
  957.     format *  : SYS.BYTE;   (* controls appearance ot datStrDate    *)
  958.     flags *   : s.SET8;     (* See BITDEF's below                   *)
  959.     strDay *  : e.ADDRESS;  (* day of the week string               *)
  960.     strDate * : e.ADDRESS;  (* date string                          *)
  961.     strTime * : e.ADDRESS;  (* time string                          *)
  962.   END; (* DateTime *)
  963.  
  964. CONST
  965.  
  966. (*
  967.  ************************************************************************
  968.  *      Size of buffer you need for each DateTime strings:              *
  969.  ************************************************************************
  970.  *)
  971.  
  972.   lenDatString   * = 10;
  973.  
  974. CONST
  975.  
  976. (*
  977.  ************************************************************************
  978.  *      For datFlags                                                   *
  979.  ************************************************************************
  980.  *)
  981.  
  982.   subSt  * = 0; (* Substitute "Today" "Tomorrow" where appropriate      *)
  983.   future * = 1; (* Day of the week is in future                         *)
  984.  
  985.  
  986. CONST
  987.  
  988. (*
  989.  ************************************************************************
  990.  *      For datFormat                                                  *
  991.  ************************************************************************
  992.  *)
  993.  
  994.   formatDos * = 0;         (* dd-mmm-yy AmigaDOS's own, unique style               *)
  995.   formatInt * = 1;         (* yy-mm-dd International format                        *)
  996.   formatUSA * = 2;         (* mm-dd-yy The good'ol'USA.                            *)
  997.   formatCDN * = 3;         (* dd-mm-yy Our brothers and sisters to the north       *)
  998.   formatMAX * = formatCDN; (* Larger than this? Defaults to AmigaDOS               *)
  999.  
  1000.  
  1001. (* --- Library Base variable -------------------------------------------- *)
  1002.  
  1003.  
  1004. VAR
  1005.  
  1006.   arp *, base *  : ArpBasePtr;
  1007.  
  1008.  
  1009. (* --- Library Functions ------------------------------------------------ *)
  1010.  
  1011. TYPE
  1012.  
  1013.   PROC * = PROCEDURE();
  1014.  
  1015. (*
  1016.  ************************************************************************
  1017.  *  These duplicate the calls in dos.library                            *
  1018.  *  Only include if you can use arp.library without dos.library         *
  1019.  ************************************************************************
  1020.  *)
  1021.  
  1022.  
  1023. PROCEDURE Open* [base,-30]
  1024.   ( name       [1] : ARRAY OF CHAR;
  1025.     accessMode [2] : LONGINT)
  1026.   : d.FileHandlePtr;
  1027. PROCEDURE Close* [base,-36]
  1028.   ( file [1] : d.FileHandlePtr );
  1029. PROCEDURE Read* [base,-42]
  1030.   ( file       [1] : d.FileHandlePtr;
  1031.     VAR buffer [2] : ARRAY OF SYS.BYTE;
  1032.     length     [3] : LONGINT)
  1033.   : LONGINT;
  1034. PROCEDURE Write* [base,-48]
  1035.   ( file   [1] : d.FileHandlePtr;
  1036.     buffer [2] : ARRAY OF SYS.BYTE;
  1037.     length [3] : LONGINT)
  1038.   : LONGINT;
  1039. PROCEDURE Input* [base,-54] ()
  1040.   : d.FileHandlePtr;
  1041. PROCEDURE Output* [base,-60] ()
  1042.   : d.FileHandlePtr;
  1043. PROCEDURE Seek* [base,-66]
  1044.   ( file     [1] : d.FileHandlePtr;
  1045.     position [2] : LONGINT;
  1046.     offset   [3] : LONGINT)
  1047.   : LONGINT;
  1048. PROCEDURE DeleteFile* [base,-72]
  1049.   ( name [1] : ARRAY OF CHAR )
  1050.   : BOOLEAN;
  1051. PROCEDURE Rename* [base,-78]
  1052.   ( oldName [1] : ARRAY OF CHAR;
  1053.     newName [2] : ARRAY OF CHAR )
  1054.   : BOOLEAN;
  1055. PROCEDURE Lock* [base,-84]
  1056.   ( name [1] : ARRAY OF CHAR;
  1057.     type [2] : LONGINT)
  1058.   : d.FileLockPtr;
  1059. PROCEDURE UnLock* [base,-90]
  1060.   ( lock [1] : d.FileLockPtr );
  1061. PROCEDURE DupLock* [base,-96]
  1062.   ( lock [1] : d.FileLockPtr )
  1063.   : d.FileLockPtr;
  1064. PROCEDURE Examine* [base,-102]
  1065.   ( lock          [1] : d.FileLockPtr;
  1066.     fileInfoBlock [2] : d.FileInfoBlockPtr )
  1067.   : BOOLEAN;
  1068. PROCEDURE ExNext* [base,-108]
  1069.   ( lock          [1] : d.FileLockPtr;
  1070.     fileInfoBlock [2] : d.FileInfoBlockPtr )
  1071.   : BOOLEAN;
  1072. PROCEDURE Info* [base,-114]
  1073.   ( lock           [1] : d.FileLockPtr;
  1074.     parameterBlock [2] : d.InfoDataPtr )
  1075.   : BOOLEAN;
  1076. PROCEDURE CreateDir* [base,-120]
  1077.   ( name [1] : ARRAY OF CHAR )
  1078.   : d.FileLockPtr;
  1079. PROCEDURE CurrentDir* [base,-126]
  1080.   ( lock [1] : d.FileLockPtr )
  1081.   : d.FileLockPtr;
  1082. PROCEDURE IoErr* [base,-132] ()
  1083.   : LONGINT;
  1084. PROCEDURE CreateProc* [base,-138]
  1085.   ( name      [1] : ARRAY OF CHAR;
  1086.     pri       [2] : LONGINT;
  1087.     segList   [3] : e.BPTR;
  1088.     stackSize [4] : LONGINT)
  1089.   : e.MsgPortPtr;
  1090. PROCEDURE Exit* [base,-144]
  1091.   ( returnCode [1] : LONGINT);
  1092. PROCEDURE LoadSeg* [base,-150]
  1093.   ( name [1] : ARRAY OF CHAR )
  1094.   : e.BPTR;
  1095. PROCEDURE UnLoadSeg* [base,-156]
  1096.   ( seglist [1] : e.BPTR );
  1097. PROCEDURE DeviceProc* [base,-174]
  1098.   ( name [1] : ARRAY OF CHAR )
  1099.   : e.MsgPortPtr;
  1100. PROCEDURE SetComment* [base,-180]
  1101.   ( name    [1] : ARRAY OF CHAR;
  1102.     comment [2] : ARRAY OF CHAR )
  1103.   : BOOLEAN;
  1104. PROCEDURE SetProtection* [base,-186]
  1105.   ( name    [1] : ARRAY OF CHAR;
  1106.     protect [2] : s.SET32)
  1107.   : BOOLEAN;
  1108. PROCEDURE DateStamp* [base,-192]
  1109.   ( VAR date [1] : d.DateBase );
  1110. PROCEDURE Delay* [base,-198]
  1111.   ( timeout [1] : e.ULONG);
  1112. PROCEDURE WaitForChar* [base,-204]
  1113.   ( file    [1] : d.FileHandlePtr;
  1114.     timeout [2] : LONGINT)
  1115.   : BOOLEAN;
  1116. PROCEDURE ParentDir* [base,-210]
  1117.   ( lock [1] : d.FileLockPtr )
  1118.   : d.FileLockPtr;
  1119. PROCEDURE IsInteractive* [base,-216]
  1120.   ( file [1] : d.FileHandlePtr )
  1121.   : BOOLEAN;
  1122. PROCEDURE Execute* [base,-222]
  1123.   ( string [1] : ARRAY OF CHAR;
  1124.     file   [2] : d.FileHandlePtr;
  1125.     file2  [3] : d.FileHandlePtr )
  1126.   : LONGINT;
  1127.  
  1128.  
  1129. (*
  1130.  ************************************************************************
  1131.  * Now for the stuff that only exists in arp.library...                 *
  1132.  ************************************************************************
  1133.  *)
  1134.  
  1135. PROCEDURE VPrintf* [base,-228]
  1136.   ( string [8] : ARRAY OF CHAR;
  1137.     args   [9] : ARRAY OF e.ADDRESS )
  1138.   : LONGINT;
  1139. PROCEDURE Printf* [base,-228]
  1140.   ( string [8]  : ARRAY OF CHAR;
  1141.     args   [9]..: e.APTR )
  1142.   : LONGINT;
  1143. PROCEDURE VFPrintf* [base,-234]
  1144.   ( file   [0] : d.FileHandlePtr;
  1145.     string [8] : ARRAY OF CHAR;
  1146.     args   [9] : ARRAY OF e.APTR )
  1147.   : LONGINT;
  1148. PROCEDURE FPrintf* [base,-234]
  1149.   ( file   [0]  : d.FileHandlePtr;
  1150.     string [8]  : ARRAY OF CHAR;
  1151.     args   [9]..: e.APTR )
  1152.   : LONGINT;
  1153. PROCEDURE Puts* [base,-240]
  1154.   ( string [9] : ARRAY OF CHAR )
  1155.   : LONGINT;
  1156. PROCEDURE ReadLine* [base,-246]
  1157.   ( VAR string [8] : ARRAY OF CHAR )
  1158.   : LONGINT;
  1159. PROCEDURE GADS* [base,-252]
  1160.   ( line      [8] : ARRAY OF CHAR;
  1161.     len       [0] : LONGINT;
  1162.     help      [9] : e.ADDRESS;
  1163.     VAR args [10] : ARRAY OF SYS.LONGWORD;
  1164.     temp     [11] : ARRAY OF CHAR )
  1165.   : LONGINT;
  1166. PROCEDURE Atol* [base,-258]
  1167.   ( string [8] : ARRAY OF CHAR )
  1168.   : LONGINT;
  1169. PROCEDURE EscapeString* [base,-264]
  1170.   ( string [8] : ARRAY OF CHAR )
  1171.   : e.ULONG;
  1172. PROCEDURE CheckAbort* [base,-270]
  1173.   ( func [9] : e.PROC )
  1174.   : LONGINT;
  1175. PROCEDURE CheckBreak* [base,-276]
  1176.   ( mask [1] : s.SET32;
  1177.     func [9] : e.PROC )
  1178.   : LONGINT;
  1179. PROCEDURE Getenv* [base,-282]
  1180.   ( string     [8] : ARRAY OF CHAR;
  1181.     VAR buffer [9] : ARRAY OF CHAR;
  1182.     size       [0] : LONGINT )
  1183.   : e.ADDRESS;
  1184. PROCEDURE Setenv* [base,-288]
  1185.   ( varName [8] : ARRAY OF CHAR;
  1186.     value   [9] : ARRAY OF CHAR )
  1187.   : BOOLEAN;
  1188. PROCEDURE FileRequest* [base,-294]
  1189.   ( VAR fileRequester [8] : FileRequester )
  1190.   : e.ADDRESS;
  1191. PROCEDURE CloseWindowSafely* [base,-300]
  1192.   ( window      [8] : i.WindowPtr;
  1193.     moreWindows [9] : i.WindowPtr );
  1194. PROCEDURE CreatePort* [base,-306]
  1195.   ( name [8] : ARRAY OF CHAR;
  1196.     pri  [0] : LONGINT )
  1197.   : e.MsgPortPtr;
  1198. PROCEDURE DeletePort* [base,-312]
  1199.   ( port [9] : e.MsgPortBasePtr );
  1200. PROCEDURE SendPacket* [base,-318]
  1201.   ( action  [0] : LONGINT;
  1202.     args    [8] : e.ADDRESS;
  1203.     handler [9] : e.MsgPortBasePtr )
  1204.   : LONGINT;
  1205. PROCEDURE InitStdPacket* [base,-324]
  1206.   ( action     [0] : LONGINT;
  1207.     args       [8] : e.ADDRESS;
  1208.     packet     [9] : d.DosPacketPtr;
  1209.     replyPort [10] : e.MsgPortBasePtr );
  1210. PROCEDURE PathName* [base,-330]
  1211.   ( lock           [0] : d.FileLockPtr;
  1212.     VAR buffer     [8] : ARRAY OF CHAR;
  1213.     componentCount [1] : LONGINT )
  1214.   : e.ULONG;
  1215. PROCEDURE Assign* [base,-336]
  1216.   ( logical  [8] : ARRAY OF CHAR;
  1217.     physical [9] : ARRAY OF CHAR )
  1218.   : e.ULONG;
  1219. PROCEDURE DosAllocMem* [base,-342]
  1220.   ( size [0] : LONGINT )
  1221.   : e.APTR;
  1222. PROCEDURE DosFreeMem* [base,-348]
  1223.   ( block [9] : e.APTR );
  1224. PROCEDURE BtoCStr* [base,-354]
  1225.   ( VAR cstr  [8] : ARRAY OF CHAR;
  1226.     bstr      [0] : d.BSTR;
  1227.     maxLength [1] : LONGINT )
  1228.   : e.ULONG;
  1229. PROCEDURE CtoBStr* [base,-360]
  1230.   ( cstr      [8] : ARRAY OF CHAR;
  1231.     VAR bstr  [0] : d.BSTR;
  1232.     maxLength [1] : LONGINT )
  1233.   : e.ULONG;
  1234. PROCEDURE GetDevInfo* [base,-366]
  1235.   ( devNode [10] : d.DeviceListPtr )
  1236.   : d.DeviceListPtr;
  1237. PROCEDURE FreeTaskResList* [base,-372] ()
  1238.   : BOOLEAN;
  1239. PROCEDURE ArpExit* [base,-378]
  1240.   ( rc    [0] : LONGINT;
  1241.     fault [2] : LONGINT );
  1242. PROCEDURE ArpAlloc* [base,-384]
  1243.   ( size [0] : LONGINT )
  1244.   : e.ADDRESS;
  1245. PROCEDURE ArpAllocMem* [base,-390]
  1246.   ( size         [0] : LONGINT;
  1247.     requirements [1] : s.SET32 )
  1248.   : e.ADDRESS;
  1249. PROCEDURE ArpOpen* [base,-396]
  1250.   ( name [1] : ARRAY OF CHAR;
  1251.     mode [2] : LONGINT )
  1252.   : d.FileHandlePtr;
  1253. PROCEDURE ArpDupLock* [base,-402]
  1254.   ( lock [1] : d.FileLockPtr )
  1255.   : d.FileLockPtr;
  1256. PROCEDURE ArpLock* [base,-408]
  1257.   ( name [1] : ARRAY OF CHAR;
  1258.     mode [2] : LONGINT )
  1259.   : d.FileLockPtr;
  1260. PROCEDURE RListAlloc* [base,-414]
  1261.   ( resList [8] : ResListPtr;
  1262.     size    [0] : LONGINT )
  1263.   : e.ADDRESS;
  1264. PROCEDURE FindCLI* [base,-420]
  1265.   ( cliNum [0] : LONGINT )
  1266.   : e.APTR;
  1267. PROCEDURE QSort* [base,-426]
  1268.   ( data  [8] : e.APTR;
  1269.     rSize [0] : LONGINT;
  1270.     bSize [1] : LONGINT;
  1271.     comp  [9] : e.PROC )
  1272.   : BOOLEAN;
  1273. PROCEDURE PatternMatch* [base,-432]
  1274.   ( pattern [8] : ARRAY OF CHAR;
  1275.     string  [9] : ARRAY OF CHAR )
  1276.   : BOOLEAN;
  1277. PROCEDURE FindFirst* [base,-438]
  1278.   ( pattern  [0] : ARRAY OF CHAR;
  1279.     VAR path [8] : AnchorPath )
  1280.   : LONGINT;
  1281. PROCEDURE FindNext* [base,-444]
  1282.   ( VAR path [8] : AnchorPath )
  1283.   : LONGINT;
  1284. PROCEDURE FreeAnchorChain* [base,-450]
  1285.   ( VAR path [8] : AnchorPath );
  1286. PROCEDURE CompareLock* [base,-456]
  1287.   ( lock1 [0] : d.FileLockPtr;
  1288.     lock2 [1] : d.FileLockPtr )
  1289.   : e.ULONG;
  1290. PROCEDURE FindTaskResList* [base,-462] ()
  1291.   : ResListPtr;
  1292. PROCEDURE CreateTaskResList* [base,-468] ()
  1293.   : ResListPtr;
  1294. PROCEDURE FreeResList* [base,-474]
  1295.   ( freeList [9] : ResListPtr );
  1296. PROCEDURE FreeTrackedItem* [base,-480]
  1297.   ( item [9] : DefaultTrackerPtr );
  1298. PROCEDURE GetTracker* [base,-486]
  1299.   ( size [9] : LONGINT )
  1300.   : DefaultTrackerPtr;
  1301. PROCEDURE GetAccess* [base,-492]
  1302.   ( tracker [9] : DefaultTrackerPtr )
  1303.   : e.APTR;
  1304. PROCEDURE FreeAccess* [base,-498]
  1305.   ( tracker [9] : DefaultTrackerPtr );
  1306. PROCEDURE FreeDAList* [base,-504]
  1307.   ( VAR node [9] : DirectoryEntry );
  1308. PROCEDURE AddDANode* [base,-510]
  1309.   ( data       [8] : ARRAY OF CHAR;
  1310.     VAR daList [9] : DirectoryEntry;
  1311.     length     [0] : LONGINT;
  1312.     id         [1] : LONGINT )
  1313.   : DirectoryEntryPtr;
  1314. PROCEDURE AddDADevs* [base,-516]
  1315.   ( VAR daList [8] : DirectoryEntry;
  1316.     select     [0] : s.SET32 )
  1317.   : e.ULONG;
  1318. PROCEDURE Strcmp* [base,-522]
  1319.   ( s1 [8] : ARRAY OF CHAR;
  1320.     s2 [9] : ARRAY OF CHAR )
  1321.   : LONGINT;
  1322. PROCEDURE Strncmp* [base,-528]
  1323.   ( s1     [8] : ARRAY OF CHAR;
  1324.     s2     [9] : ARRAY OF CHAR;
  1325.     length [0] : LONGINT )
  1326.   : LONGINT;
  1327. PROCEDURE ToUpper* [base,-534]
  1328.   ( char [0] : CHAR )
  1329.   : CHAR;
  1330. PROCEDURE SyncRun* [base,-540]
  1331.   ( name    [8] : ARRAY OF CHAR;
  1332.     command [9] : e.ADDRESS;
  1333.     input   [0] : d.FileHandlePtr;
  1334.     output  [1] : d.FileHandlePtr )
  1335.   : LONGINT;
  1336.  
  1337. (*
  1338.  ************************************************************************
  1339.  *  Added V32 of arp.library                                            *
  1340.  ************************************************************************
  1341.  *)
  1342.  
  1343. PROCEDURE ASyncRun* [base,-546]
  1344.   ( name     [8] : ARRAY OF CHAR;
  1345.     command  [9] : e.ADDRESS;
  1346.     VAR pcb [10] : ProcessControlBlock )
  1347.   : LONGINT;
  1348. PROCEDURE SpawnShell* [base,-546]
  1349.   ( name       [8] : ARRAY OF CHAR;
  1350.     command    [9] : e.ADDRESS;
  1351.     VAR shell [10] : NewShell )
  1352.   : LONGINT;
  1353. PROCEDURE LoadPrg* [base,-552]
  1354.   ( name [1] : ARRAY OF CHAR )
  1355.   : e.BPTR;
  1356. PROCEDURE PreParse* [base,-558]
  1357.   ( source   [8] : ARRAY OF CHAR;
  1358.     VAR dest [9] : ARRAY OF CHAR )
  1359.   : BOOLEAN;
  1360.  
  1361. (*
  1362.  ************************************************************************
  1363.  * Added V33 of arp.library                                             *
  1364.  ************************************************************************
  1365.  *)
  1366.  
  1367. PROCEDURE StamptoStr* [base,-564]
  1368.   ( VAR dateTime [8] : DateTime )
  1369.   : BOOLEAN;
  1370. PROCEDURE StrtoStamp* [base,-570]
  1371.   ( VAR dateTime [8] : DateTime )
  1372.   : BOOLEAN;
  1373. PROCEDURE ObtainResidentPrg* [base,-576]
  1374.   ( name [8] : ARRAY OF CHAR )
  1375.   : ResidentProgramNodePtr;
  1376. PROCEDURE AddResidentPrg* [base,-582]
  1377.   ( segment [1] : e.BPTR;
  1378.     name    [8] : ARRAY OF CHAR )
  1379.   : ResidentProgramNodePtr;
  1380. PROCEDURE RemResidentPrg* [base,-588]
  1381.   ( name [8] : ARRAY OF CHAR )
  1382.   : LONGINT;
  1383. PROCEDURE UnLoadPrg* [base,-594]
  1384.   ( segment [1] : e.BPTR );
  1385. PROCEDURE LMult* [base,-600]
  1386.   ( a [0] : LONGINT;
  1387.     b [1] : LONGINT )
  1388.   : LONGINT;
  1389. PROCEDURE LDiv* [base,-606]
  1390.   ( a [0] : LONGINT;
  1391.     b [1] : LONGINT )
  1392.   : LONGINT;
  1393. PROCEDURE LMod* [base,-612]
  1394.   ( a [0] : LONGINT;
  1395.     b [1] : LONGINT )
  1396.   : LONGINT;
  1397. PROCEDURE CheckSumPrg* [base,-618]
  1398.   ( VAR node [0] : ResidentProgramNode )
  1399.   : e.ULONG;
  1400. PROCEDURE TackOn* [base,-624]
  1401.   ( VAR pathname [8] : ARRAY OF CHAR;
  1402.     filename     [9] : ARRAY OF CHAR );
  1403. PROCEDURE BaseName* [base,-630]
  1404.   ( name [8] : ARRAY OF CHAR )
  1405.   : e.ADDRESS;
  1406. PROCEDURE ReleaseResidentPrg* [base,-636]
  1407.   ( segment [1] : e.BPTR )
  1408.   : ResidentProgramNodePtr;
  1409.  
  1410. (*
  1411.  ************************************************************************
  1412.  * Added V36 of arp.library                                             *
  1413.  ************************************************************************
  1414.  *)
  1415.  
  1416. PROCEDURE SPrintf* [base,-642]
  1417.   ( file   [0] : e.ADDRESS;
  1418.     string [8] : ARRAY OF CHAR;
  1419.     stream [9] : e.ADDRESS )
  1420.   : LONGINT;
  1421. PROCEDURE GetKeywordIndex* [base,-648]
  1422.   ( key      [8] : ARRAY OF CHAR;
  1423.     template [9] : ARRAY OF CHAR )
  1424.   : LONGINT;
  1425. PROCEDURE ArpOpenLibrary* [base,-654]
  1426.   ( name    [9] : ARRAY OF CHAR;
  1427.     version [0] : LONGINT )
  1428.   : e.LibraryPtr;
  1429. PROCEDURE ArpAllocFreq* [base,-660] ()
  1430.   : FileRequesterPtr;
  1431.  
  1432.  
  1433. (* --- Library Base variable -------------------------------------------- *)
  1434. <*$LongVars-*>
  1435.  
  1436. (*------------------------------------*)
  1437. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  1438.  
  1439. BEGIN (* CloseLib *)
  1440.   IF base # NIL THEN e.CloseLibrary (base) END
  1441. END CloseLib;
  1442.  
  1443. BEGIN (* ARP *)
  1444.   base := SYS.VAL (ArpBasePtr,
  1445.                    e.OpenLibrary (arpName, arpVersion));
  1446.   IF base = NIL THEN HALT (100) END;
  1447.   arp := base; Kernel.SetCleanup (CloseLib)
  1448. END ARP.
  1449.